<template>
	<view class="tui-head-title">
		<view class="tui-title-flex">
			<view class="tui-title-left">
				<image :src="image" class="tui-pd-right title-image" mode="aspectFill"></image>
				<text>{{title}}</text>
			</view>
			<view v-if="showRight" class="tui-title-right" @tap="navTo(url)">
				<text>查看全部</text>
				<uni-icons type="arrowright" size="28" color="#666"></uni-icons>
			</view>
		</view>
	</view>
</template>

<script>
	import uniIcons from '@/components/uni-icons/uni-icons.vue'
	
	export default {
		props: {
			title: {
				type: String,
				default: ''
			},
			url: {
				type: String,
				default: ''
			},
			showRight: {
				type: Boolean,
				default: false
			},
            image: {
                type: String,
                default: '/static/image/icon/ecology.png'
            }
		},
		components: {
			uniIcons
		},
		
		data() {
			return {
				
			}
		},
		methods: {
			navTo(url) {
				uni.navigateTo({
					url: url
				})
			}
		}
	}
</script>

<style lang="scss">
	.tui-head-title {
		margin: 20rpx 30rpx;
		.tui-title-flex {
			display: flex;
			justify-content: space-between;
			align-items: center;
			
			.tui-title-left {
				font-size: 38rpx;
				color: #333;
				display: flex;
				align-items: center;
				.title-image {
					width: 68rpx;
					height: 52rpx;
				}
			}
			.tui-title-right {
				font-size: 24rpx;
				color: #666;
			}
		}
	}
</style>
